'''
Created on 01.12.2009

@author: stud
'''
from Tkinter import *

global entry
global lichtStatus
global lichtLabel

def myEcho():
    global entry
    print entry.get()

def umschalten():
    global lichtStatus
    lichtStatus = not lichtStatus
    if lichtStatus:
        lichtLabel.config(bg='white', fg='black', text='Licht an')    
    else:
        lichtLabel.config(fg='white', bg='black', text='Licht aus')    

if __name__ == '__main__':
    root = Tk()
    root.title('Umfrage')

    questionFrame = Frame(root)
    questionLabel = Label(questionFrame, 
        text='Ich interessiere mich fuer Informatik, weil ...')
    questionLabel.pack(side=TOP)
    questionEntry = Entry(questionFrame)
    entry=questionEntry
    questionEntry.pack(side=BOTTOM, padx=5, pady=5, fill=X)
    questionFrame.pack(side=TOP,  fill=BOTH, expand=False)

    buttonFrame = Frame(root)
    okButton = Button(buttonFrame, text='Ok', command=myEcho)
    cancelButton = Button(buttonFrame, text='Abbrechen', command=root.quit)
    okButton.pack(side=TOP, fill=X)
    cancelButton.pack(side=BOTTOM)
    buttonFrame.pack(side=RIGHT, expand=False)

    lichtStatus=False
    lichtFrame = Frame(root)
    lichtSchalter = Button(lichtFrame, text='An / Aus', command=umschalten)
    lichtLabel = Label(lichtFrame, bg='black')
    lichtSchalter.pack(side=BOTTOM)
    lichtLabel.pack(side=TOP, fill=BOTH, expand=True)
    lichtFrame.pack(side=LEFT, fill=BOTH, expand=True)

    root.mainloop()